/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.ufc.quixada.comandos;

import br.com.ufc.quixada.interfaces.Comando;
import br.com.ufc.quixada.util.SendMail;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Administrator
 */
public class CmdEnviarEmailCadastro implements Comando {
   
    @Override
    public String executa(HttpServletRequest request, HttpServletResponse response) {
        String email = request.getParameter("emaildestino");
        String assunto = request.getParameter("assuntoemail");
        String menssagen = request.getParameter("menssagenemail");
        try {
            SendMail.sendMail(email, assunto, menssagen);
            return "/cadastronaoativado.jsp";
        } catch (AddressException ex) {
            Logger.getLogger(CmdEnviarEmailAluguel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MessagingException ex) {
            Logger.getLogger(CmdEnviarEmailAluguel.class.getName()).log(Level.SEVERE, null, ex);
        }
        return "/cadastronaoativado.jsp";
    }

}
